
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@page import="gruppe7.util.Html" %>
<%@page import="gruppe7.model.User" %>
<%@page import="gruppe7.model.Model" %>
<%@page import="gruppe7.model.Station" %>
<%@page import="gruppe7.control.ServletController" %>

<%
Html html = new Html(); 
ServletController sc = ServletController.getInstance();
User user = sc.getSession(request, response).getUser();
Model model = Model.getInstance();
%>

<% out.print(html.setHeader("Edit station info")); %>

<body>
<jsp:include page="main_links.jsp" />

<div id ='content'>
<div id='content-left'>
<h3><img src='images/edit.png'/> Edit station info</h3><br/> 

<%
	
String stationName = request.getParameter("station");
String oldName = stationName;

Station station = null;

try {
	station = model.getStationByName(oldName);
} catch (Exception e) {
	out.println("Database-fejl: " + e);
}

int zone = station.getZone();

out.println("<p>"
		+ "<table class='default'>"
		+ "<form action='save_station.do' method='post'>"
		+ "<tr><td>Edit name </td><td><input type='text' name='editedName' value='" + stationName + "'/></td></tr>"
		+ "<tr><td>Edit zone </td><td><input type='text' name ='editedZone' value='" + zone + "'/>"
		+ "<input type='hidden' name ='oldName' value='" + oldName + "'/></td></tr>"
		+ "<tr><td>Edit comment </td><td><input type='text' name='comment' value='" + station.getComment() + "'/></td></tr>"
		+ "<tr><td>Edit manager </td><td><input type='text' name='manager' value='" + station.getManager() + "'/></td></tr>"
		+ "<tr><td>Edit erection date </td><td><input type='text' name='erectiondate' value='" + station.getErectionDate() + "'/></td></tr>"
		+ "<tr><td></td><td align='right'><input class='submit' type='submit' value='Save'/></td></tr>"
		+ "</form>"
		+ "</table>"
		+ "</p>"
		+ "<br /><p><a href='javascript: history.go(-1)'>Back</a></P>");

out.println("</div></div>");
out.println(html.setFooter());

%>

